Talk:FAQ/@comment-98.102.170.214-20200205053914/@comment-27333362-20200205201850
Yikes. Okay. So you'll have an init.sqf - it's the stuff that gets run when the mission starts. This needs to be in it, so paste it in there (manually) at the start. The first line tells it not to activate the player character. The second line tells it to fade the sound.. The third adds an event handler for the player being killed (not strictly necessary, but does no harm). The next line tell it to run intro.sqf from a folder called scripts. When it's finished doing that, the last line tells it to start simulating the player so you can actually start doing stuff. player enablesimulation false; 0 fadeSound 0; player addEventHandler {3 fadeSound 0; 3 fademusic 0; 3 fadeRadio 0}; execVM "scripts\intro.sqf"; player enablesimulation true; You will not have an intro.sqf so you'll have to make one. If there is not a folder called scripts in your working folder, then make one. In it create a new file called intro.sqf and paste the code below into it. I'll comment on each line. Note that the // lines are comments that you can leave in the code and it'll ignore them // sets the rain randomly. Not necessary 0 setRain random 0.7; // sets the fog randomly. Not necessary 0 setFog 0.3; // sets the time randomly. Not necessary skiptime random 3; // stops running the code for 1 second (allows time for stuff to happen) sleep 1; // sets a variable to private to stop it over-writing any local variable of the same name private "_unit"; // sets five spawn markers _markers = "spawn2", "spawn3", "spawn4", "spawn5"; // chooses one at random _p = _markers call BIS_fnc_selectRandom; // makes sure the spawn point is by a road _list = (getMarkerPos _p) nearRoads 1000; // chooses a road at random _road = _list call BIS_fnc_selectRandom; // gets the actual position of the road, so the truck can be on it _pos = getposATL _road; // makes sure there's another road nearby _nextRoad = (_road nearRoads 50) select 0; // sets up which type of truck will be created - you can select a different one by replacing I_Truck_02_covered_F with the classname of another vehicle (look up vehicle classnames) _veh = createVehicle _pos, [, 0, "FORM"]; // sets which way the vehicle is pointing _veh setDir ((_nextRoad call BIS_fnc_relativeDirTo) + (random 20 - random 20)); // aligns the vehicle with the road (so it's not pointing into the sky or some shit) _veh setVectorUP (surfaceNormal _veh) select 0, (getPosATL _veh) select 1); // true call rvg_fnc_vehInit; // stop running stuff for half a second sleep 0.5; // create a fake group into which to put the driver and all the passengers (necessary to have them all in the same vehicle) _dummyGrp = createGroup West; // creates the driver unit _driver = _dummyGrp createUnit _pos, [, 0, "FORM"]; // adds gear (equipment) to the driver _driver call RVG_fnc_AddGear; // takes away his backpack removeBackpack _driver; // takes away his vest removeVest _driver; // Chooses a new vest from the list contained in rvg_vests (it's just a list of classnames) _driver addVest (selectRandom rvg_vests); // Gives a random weapon _driver call RVG_fnc_AddWeapon; if !(rvg_weapons isEqualTo []) then { _weapon = rvg_weapons select (((floor random [(((count rvg_weapons) - 1)*1.25)*-1,((count rvg_weapons) - 1)*0.5,((count rvg_weapons) - 1)*1.5) max 0) min ((count rvg_weapons) - 1)), 2] call BIS_fnc_addWeapon; } else { _weapon = rvg_weaponsA3 select (((floor random [(((count rvg_weaponsA3) - 1)*1.25)*-1,((count rvg_weaponsA3) - 1)*0.5,((count rvg_weaponsA3) - 1)*1.5) max 0) min ((count rvg_weaponsA3) - 1)), 2] call BIS_fnc_addWeapon; }; // gives him some other stuff _driver call RVG_fnc_AddLoot; // puts the driver in the vehicle _driver moveindriver _veh; //throws the driver out of the vehicle, so he's on the ground - otherwise he'd be in the driver's seat _driver action vehicle _driver; // wait for 0.2 seconds to let the driver ejection happen sleep 0.2; // make him dead _driver setdamage 1; // sets up an outfit for the player and the dead passengers _prisonUniform = "U_C_WorkerCoveralls"; if (isClass(configFile >> "CfgWeapons" >> "U_Captive_A")) then { _prisonUniform = "U_Captive_A"; }; for "_i" from 2 to 5 do { _unit = _dummyGrp createUnit _pos, [, 0, "FORM"]; _unit forceAddUniform _prisonUniform; removeGoggles _unit; _unit moveincargo _i; _unit setDamage 1; }; // forces the player outfit to that selected player forceAddUniform _prisonUniform; // puts the player in the vehicle - in the 'cargo space' i.e. the back player moveincargo 6; // creates more dead dummies in the back for "_i" from 7 to 9 do { _unit = _dummyGrp createUnit _pos, [, 0, "FORM"]; // makes sure they all have the same outfit _unit forceAddUniform _prisonUniform; // makes sure they don't have goggles removeGoggles _unit; // puts them in the various seats _unit moveincargo _i; // makes them dead _unit setDamage 1; }; // deletes the dummy group that was needed to put all the bodies in the back and stuff deleteGroup _dummyGrp; // this bit creates a wrecked car beside the truck, so that there's something for it to have crashed into. You can skip this section entirely _posWreck = _veh modelToWorld 7, 0; _wreck = createVehicle [_posWreck select 0, _posWreck select 1, 0, [], 0, "FORM"]; _wreck setVectorUP (surfaceNormal _wreck) select 0, (getPosATL _wreck) select 1); _wreck,"FIRE_BIG" spawn RVG_fnc_createFireEffect; _soundSource = createSoundSource getPosATL _wreck, [, 0]; I hope this is enough to get you going. Let me know if it isn't and I'll try to walk you through it further. I haven't actually written a mission in eight years, so I'm a little(!) rusty